<?php
/**
 * Created by PhpStorm.
 * User: hualei
 * Date: 2015/5/31
 * Time: 10:44
 */
namespace app\modules\admin\controllers;
use Yii;
use yii\filters\AccessControl;
use yii\web\Controller;
use yii\filters\VerbFilter;
class AccountController extends Controller
{
//public $enableCsrfValidation = false;
    public $layout='admin';
    public function behaviors()
    {
        return [
            'access' => [
                'class' => AccessControl::className(),
                'only' => ['main'],
                'rules' => [
                    [
                        'actions' => ['main'],
                        'allow' => true,
                        'roles' => ['@'],
                    ],
                ],
            ],

        ];
    }

    public function actions()
    {
        return [
            'error' => [
                'class' => 'yii\web\ErrorAction',
            ],
        ];
    }
    public function actionMain()
    {
        if(!\Yii::$app->user->can('view'))
            throw new Exception('need view Permission.');
        else {
            return $this->render('main', []);
        }
    }
}